﻿<UserControl x:Class="Framework.UI.TestHarness.Views.ProgressView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:metro="http://schemas.codeplex.com/elysium"
             xmlns:params="http://schemas.codeplex.com/elysium/params"
             xmlns:extra="http://schemas.extra.com/ui"
             mc:Ignorable="d" 
             d:DesignHeight="768" d:DesignWidth="1024">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <StackPanel>
            <TextBlock Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                       Style="{StaticResource HeaderTextStyle}" 
                       Text="Window Progress Bar"/>
            <TextBlock Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                       Style="{StaticResource NormalTextStyle}" 
                       Text="All windows have a progress bar built in at the top. Try it:"/>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Label Content="IsBusy"
                       Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                       Target="{Binding ElementName=IsBusyToggleSwitch}"/>
                <metro:ToggleSwitch x:Name="IsBusyToggleSwitch" 
                                    Grid.Column="1"
                                    HorizontalAlignment="Left"
                                    IsChecked="{Binding Path=IsBusy, RelativeSource={RelativeSource AncestorType=extra:Window}}"
                                    Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"/>

            </Grid>
        </StackPanel>

        <StackPanel Grid.Row="1">
            <TextBlock Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                       Style="{StaticResource HeaderTextStyle}" 
                       Text="Task Bar Progress Bar"/>
            <TextBlock Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                       Style="{StaticResource NormalTextStyle}" 
                       Text="Windows 7 and above add various Taskbar capabilities via the TaskbarItemInfo property on the Window. Here are examples of how to use them. A few helper properties have been added to the window to help with binding."/>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <Label Content="TaskbarIsBusy"
                       Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                       Target="{Binding ElementName=TaskbarIsBusyToggleSwitch}"/>
                <metro:ToggleSwitch x:Name="TaskbarIsBusyToggleSwitch" 
                                    Grid.Column="1"
                                    HorizontalAlignment="Left"
                                    IsChecked="{Binding Path=TaskbarIsBusy, RelativeSource={RelativeSource AncestorType=extra:Window}}"
                                    Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"/>

                <Label Grid.Row="1"  
                       Content="TaskbarProgressState"
                       Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                       Target="{Binding ElementName=TaskbarProgressStateComboBox}"/>
                <ComboBox x:Name="TaskbarProgressStateComboBox" 
                          Grid.Column="1"
                          Grid.Row="1"
                          Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                          SelectedItem="{Binding Path=TaskbarProgressState, RelativeSource={RelativeSource AncestorType=extra:Window}}">
                    <TaskbarItemProgressState>None</TaskbarItemProgressState>
                    <TaskbarItemProgressState>Indeterminate</TaskbarItemProgressState>
                    <TaskbarItemProgressState>Normal</TaskbarItemProgressState>
                    <TaskbarItemProgressState>Error</TaskbarItemProgressState>
                    <TaskbarItemProgressState>Paused</TaskbarItemProgressState>
                </ComboBox>

                <Label Grid.Row="2" 
                       Content="TaskbarProgressValue"
                       Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                       Target="{Binding ElementName=TaskbarProgressValueDoubleUpDown}"/>
                <extra:DoubleUpDown x:Name="TaskbarProgressValueDoubleUpDown" 
                                    Grid.Column="1"
                                    Grid.Row="2" 
                                    AllowSpin="True"
                                    FormatString="N2"
                                    Increment="0.1"
                                    Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                    Maximum="1"
                                    Minimum="0"
                                    ShowButtonSpinner="True"
                                    Value="{Binding Path=TaskbarProgressValue, RelativeSource={RelativeSource AncestorType=extra:Window}}"/>

            </Grid>
        </StackPanel>

        <Grid Grid.Row="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            
            <TextBlock Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                       Style="{StaticResource HeaderTextStyle}" 
                       Text="Loading Content"/>
            <TextBlock Grid.Row="1" 
                       Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                       Style="{StaticResource NormalTextStyle}" 
                       Text="Note that the default style only works well if the LoadingContent control extends from left to right in the window. If this is not the case use the RingLoadingContent style shown below."/>
            <extra:LoadingContent x:Name="LoadingContent"
                                  Grid.Row="2">
                <TextBlock HorizontalAlignment="Center" Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                           Style="{StaticResource HeaderTextStyle}" 
                           Text="Default LoadingContent Style"
                           VerticalAlignment="Center"/>
            </extra:LoadingContent>
            <CheckBox Grid.Row="3" 
                      Content="Loaded" 
                      IsChecked="{Binding ElementName=LoadingContent, Mode=TwoWay, Path=IsContentLoaded}"
                      Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                      VerticalAlignment="Center"/>
            <extra:LoadingContent x:Name="RingLoadingContent"
                                  Grid.Row="4"
                                  Style="{StaticResource RingLoadingContentStyle}">
                <TextBlock HorizontalAlignment="Center" Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                           Style="{StaticResource HeaderTextStyle}" 
                           Text="RingLoadingContent Style"
                           VerticalAlignment="Center"/>
            </extra:LoadingContent>
            <CheckBox Grid.Row="5" 
                      Content="Loaded" 
                      IsChecked="{Binding ElementName=RingLoadingContent, Mode=TwoWay, Path=IsContentLoaded}"
                      Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                      VerticalAlignment="Center"/>
        </Grid>
    </Grid>
</UserControl>
